package com.bysj.lms.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bysj.lms.mapper.RoomMapper;
import com.bysj.lms.pojo.entity.Room;
import com.bysj.lms.service.IRoomService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author xiaojiakai
 * @since 2022-03-08
 */
@Service
public class RoomServiceImpl extends ServiceImpl<RoomMapper, Room> implements IRoomService {



    @Override
    public PageInfo findByPage(String name, Integer page, Integer count) {
        PageHelper.startPage(page,count);
        boolean condition = StringUtils.isNotBlank(name)&&StringUtils.isNotEmpty(name);
        List<Room> list = lambdaQuery().like(condition, Room::getName, name).list();
        return new PageInfo(list);
    }
}
